package nfes.the.main;

import java.io.FileReader;

import com.thoughtworks.xstream.XStream;
import java.security.NoSuchAlgorithmException;
import nfes.the.classes.SequencialRPS;
import nfes.the.classes.XmlHelper;
import nfes.the.util.Constantes;
import nfes.the.util.Util;

/**
 * @author Julianna Paz
 */
//colocar id nas tag
public class LerSequencialRPS {

    public static void main(String args[]) throws NoSuchAlgorithmException {
        buscarBeanPorXml();
    }

    /**
     * Usada para tratar o xml retornado do servidor
     */
    public static void buscarBeanPorXml() {
        
        XmlHelper xmlHelper = Util.buscarBeanPorXml(Constantes.caminhoSalvarXMLRetorno + "consultaSequencial06052015.xml");
        
        XStream xStream = xmlHelper.getxStream();
        FileReader ler = xmlHelper.getFileReader();

        xStream.alias("ns1:RetornoConsultaSeqRps", SequencialRPS.class);
        SequencialRPS sequencial = (SequencialRPS) xStream.fromXML(ler);
        System.out.println("ultimo RPS: " + sequencial.getCabecalho().getNroUltimoRps());
    }
}
